home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / propage / genies / donsgenies / don'sgenies / printwithoffsets.pprx < prev    next >
Text File  |  1993-06-24  |  3KB  |  121 lines

  1. /*
  2. This genie allows you to print to a "Dot-Matrix" (i.e. non-PostScript) printer with different offsets for alternate pages.
  3. Written by Don Cox   June 93. Not Public Domain.
  4. */
  5.  
  6.  
  7. cr = '0a'x
  8. address command
  9. call SafeEndEdit.rexx()
  10. units = ppm_GetUnits()
  11. if units = 3 then call ppm_SetUnits(2)
  12. currentoffset = ppm_GetDMOffset()
  13.  
  14. signal on halt
  15. signal on break_c
  16. signal on break_e
  17. signal on break_d
  18.  
  19. cu = "in"
  20. if units = 2 then cu = "cm"
  21.  
  22. call ppm_AutoUpdate(0)
  23.  
  24. trace r
  25.  
  26. source = ppm_Inform(3,"Settings from...","Same again","Type Them In","Disk file")
  27.  
  28. totalpages = ppm_Numpages()
  29.  
  30. formstring = ""
  31.  
  32. if source = 0 then do
  33.     if open("temp","ram:offprint.data","R") then do
  34.         formstring = readch("temp",512)
  35.         call close("temp")
  36.         end
  37.     if formstring = "" then source = 1  /* defaults if failed  */
  38.     end   /* source = 0  */
  39.  
  40. if source = 2 then do
  41.     loadfile = ppm_GetFileName("Load settings from disk","PPage:","")
  42.     if loadfile = "" then break
  43.     if open("loader",loadfile,"R") then do
  44.         formstring = readch("loader",512)
  45.         call close("loader")
  46.         end
  47.     if formstring = "" then source = 1  /* go for defaults  */
  48.     end
  49.  
  50. if formstring = "" then formstring ="Xoffset, p.1 ("cu"):0"||cr"YOffset, p.1 ("cu"):0"||cr||"Xoffset, p.2 ("cu"):0"||cr"YOffset, p.2 ("cu"):0"||cr"save settings? (Y/N):N"
  51.  
  52.  
  53. form = ppm_GetForm("Print with Offsets", 12, formstring)
  54. if form = '' then exit_msg("Give Up")
  55.  
  56. parse var form Xoffset1 '0a'x Yoffset1 '0a'x Xoffset2 '0a'x Yoffset2 '0a'x Saving 
  57.  
  58.  
  59. if Xoffset1 = '' then Xoffset1 = 0
  60. if Yoffset1 = '' then Yoffset1 = 0
  61. if Xoffset2 = '' then Xoffset2 = 0
  62. if Yoffset2 = '' then Yoffset2 = 0
  63. saving = upper(saving)
  64. if saving ~= 'Y' then saving = "N"
  65.  
  66. if ~(datatype(Xoffset1, n)) then exit_msg("Invalid Entry for Xoffset1: "Xoffset1)
  67. if ~(datatype(Yoffset1, n)) then exit_msg("Invalid Entry for Yoffset1: "Yoffset1)
  68. if ~(datatype(Xoffset2, n)) then exit_msg("Invalid Entry for Xoffset2: "Xoffset2)
  69. if ~(datatype(Yoffset2, n)) then exit_msg("Invalid Entry for Yoffset2: "Yoffset2)
  70.  
  71.  
  72. formstring ="Xoffset, p.1 ("cu"):"Xoffset1||cr"YOffset, p.1 ("cu"):"Yoffset1||cr||"Xoffset, p.2 ("cu"):"Xoffset2||cr"YOffset, p.2 ("cu"):"Yoffset2||cr"save settings? (Y/N):"saving
  73.  
  74.  
  75. if open("temp","ram:offprint.data","W") then do
  76.     call seek("temp",0,"B") 
  77.     call writech("temp",formstring)
  78.     call close("temp")
  79.     end
  80.  
  81. if upper(Saving) = "Y" then do
  82.     savefile = ppm_GetFileName("Save settings to disk","PPage:","")
  83.     if savefile = "" then break
  84.     if open("saver",savefile,"W") then do
  85.         call writech("saver",formstring)
  86.         call close("saver")
  87.         end
  88.     end
  89.  
  90. do i=1 to totalpages
  91.     call ppm_SetDMOffset(Xoffset1, Yoffset1)
  92.     call ppm_ShowStatus("   Printing Page "i)
  93.     call ppm_PrintPageDM(i,1,1)
  94.     i=i+1
  95.     if i>totalpages then break
  96.     call ppm_ShowStatus("   Printing Page "i)
  97.     call ppm_SetDMOffset(Xoffset2, Yoffset2)
  98.     call ppm_PrintPageDM(i,1,1)
  99.     end
  100.  
  101. call ppm_SetDMOffset(word(currentoffset,1), word(currentoffset,2))
  102. call exit_msg("Done")
  103.  
  104.  
  105. break_d:
  106. break_e:
  107. break_c:
  108. halt:
  109.     call exit_msg("User aborted Genie!")
  110.  
  111. exit_msg: procedure  expose units
  112. do
  113.     parse arg message
  114.  
  115.     if message ~= '' then call ppm_Inform(1, message,"Resume")
  116.     call ppm_ClearStatus()
  117.     call ppm_SetUnits(units)
  118.     call ppm_AutoUpdate(1)
  119.     exit
  120. end
  121.